package com.hk.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hk.domain.User;
import com.hk.mapper.UserMapper;
import com.hk.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 第一张测试表 服务实现类
 * </p>
 *
 * @author yixin
 * @since 2023-02-12
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {


    @Autowired
    private UserMapper userMapper;


    public List<User> getAllUser() {
        List<User> list = list(new LambdaQueryWrapper<>());
        return list;
    }

    @Override
    public User getUserInfoByName(String name) {
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.eq("name",name);
        User user = userMapper.selectOne(wrapper);
        return user;
    }

//    @Override
//    public User queryUserByName(String username) {
//        LambdaQueryWrapper<User> lambdaQueryWrapper = new LambdaQueryWrapper<User>()
//                .apply("yxbz = 'Y'")
//                .eq(User::getUsername, username);
//        User user = getOne(lambdaQueryWrapper);
//        return user;

//    }

}
